<?php

// module/Site/src/Album/Controller/AlbumController.php:

namespace Registration\Controller;

use Registration\Model\Position;
use Registration\Model\PositionTable;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;

class RegistrationController extends AbstractActionController {

    protected $positionTable;

    private function getPositionTable() {
        if (!$this->positionTable) {
            $sm = $this->getServiceLocator();
            $this->positionTable = $sm->get('Registration\Model\PositionTable');
        }
        return $this->positionTable;
    }

    public function indexAction() {
        return new ViewModel(array(
                    'positions' => $this->getPositionTable()->fetchAll(),
                ));
    }

    public function testAction() {
        $id = (int) $this->params()->fromRoute('page', 0);
        return new ViewModel(array(
                    'page' => 'test page variable "$page"',
                    'id' => $id,
                ));
    }

    public function pageAction() {
        $id = (int) $this->params()->fromRoute('page', 0);
        return new ViewModel(array(
                    'page' => 'page variable "$page"',
                    'id' => $id,
                ));
    }

}
